--------------------------------------------------------
-- Archivo creado  - martes-septiembre-23-2014   
--------------------------------------------------------
--------------------------------------------------------
--  DDL for Table LUGARES_CALIDAD
--------------------------------------------------------

  CREATE TABLE "MINAM"."LUGARES_CALIDAD" 
   (	"ID" NUMBER, 
	"COORDENADAX" VARCHAR2(20 BYTE), 
	"COORDENADAY" VARCHAR2(20 BYTE), 
	"TITULO" VARCHAR2(50 BYTE)
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" ;
REM INSERTING into MINAM.LUGARES_CALIDAD
SET DEFINE OFF;
Insert into MINAM.LUGARES_CALIDAD (ID,COORDENADAX,COORDENADAY,TITULO) values ('1','-6.7771244','-79.8495555','Chiclayo');
Insert into MINAM.LUGARES_CALIDAD (ID,COORDENADAX,COORDENADAY,TITULO) values ('2','-4.5614198','-81.240675','Talara');
Insert into MINAM.LUGARES_CALIDAD (ID,COORDENADAX,COORDENADAY,TITULO) values ('3','-12.0553442','-77.0451853','Lima');
--------------------------------------------------------
--  DDL for Index LUGARES_CALIDAD_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "MINAM"."LUGARES_CALIDAD_PK" ON "MINAM"."LUGARES_CALIDAD" ("ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 167 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" ;
--------------------------------------------------------
--  Constraints for Table LUGARES_CALIDAD
--------------------------------------------------------

  ALTER TABLE "MINAM"."LUGARES_CALIDAD" ADD CONSTRAINT "LUGARES_CALIDAD_PK" PRIMARY KEY ("ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 167 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE;
  ALTER TABLE "MINAM"."LUGARES_CALIDAD" MODIFY ("ID" NOT NULL ENABLE);
--------------------------------------------------------
--  DDL for Trigger TRIG_FAB
--------------------------------------------------------
CREATE SEQUENCE  "MINAM"."CFAB"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 41 CACHE 20 NOORDER  NOCYCLE ;
  CREATE OR REPLACE TRIGGER "MINAM"."TRIG_FAB" 
BEFORE INSERT ON LUGARES_CALIDAD
FOR EACH ROW
BEGIN
SELECT cfab.NEXTVAL INTO :NEW.ID FROM DUAL;
END;
/
ALTER TRIGGER "MINAM"."TRIG_FAB" ENABLE;
